<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - TimeIntervalField Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

 </head>

 <body class="yui-skin-sam">

<h1>inputEx - TimeIntervalField Usage</h1>

<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>

<script type="text/javascript" src="../lib/yui/element/element-min.js"></script>
<script type="text/javascript" src="../lib/yui/button/button-min.js"></script>
<script type="text/javascript" src="../lib/yui/calendar/calendar-min.js"></script>

<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/mixins/choice.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/Group.js"  type='text/javascript'></script>
<script src="../js/fields/SelectField.js"  type='text/javascript'></script>
<script src="../js/fields/CombineField.js"  type='text/javascript'></script>
<script src="../js/fields/TimeIntervalField.js"  type='text/javascript'></script>


<script src="js/dpSyntaxHighlighter.js"></script>
<script src="inputex-examples.js"></script>




<!-- Example 1 -->
<div class='exampleDiv'>
 <h2>Basic TimeIntervalField creation</h2>
 <p>Use the following code to create a basic inputEx TimeIntervalField.</p>
 <div class='demoContainer' id='container1'></div>
 <div class='codeContainer'>
  <textarea name="code" class="JScript">
		var field = new inputEx.TimeIntervalField({parentEl: 'container1', label: 'Length',value:82800});
		var button = inputEx.cn('button', null, null, 'getValue');
		YAHOO.util.Event.addListener(button, "click",function() {
			alert(field.getValue()+" (seconds)");
		});
		YAHOO.util.Dom.get('container1').appendChild(button);
  </textarea>
 </div>
</div>



<!-- Example 2 -->
<div class='exampleDiv'>
 <h2>TimeIntervalField options</h2>
 <p>You can set the <i>fields</i> and <i>separators</i> options of the combine field to customize the field</p>
 <div class='demoContainer' id='container2'></div>
 <div class='codeContainer'>
  <textarea name="code" class="JScript">
	  var units = inputEx.TimeIntervalField.units;
	  var unitsStr = inputEx.messages.timeUnits;
	  var n=[]; for(var i=1;i !=30;i++){ n.push(i); }
	  var fields = [
	       {type: 'select', choices: n },
	       {
	          type: 'select',
	          choices: [
					{ value: units.DAY, label: unitsStr.DAY },
					{ value: units.MONTH, label: unitsStr.MONTH },
					{ value: units.YEAR, label: unitsStr.YEAR }
				]
	       }
	    ];

		new inputEx.TimeIntervalField({
			parentEl: 'container2',
			value: 60*24*2, // 2 days 
			unit: inputEx.TimeIntervalField.units.MINUTE,
			label: 'Continue',
			fields: fields,
			separators: ["for&nbsp;", "&nbsp;&nbsp;", false]
		});
  </textarea>
 </div>
</div>

 </body>
</html>